package com.Apo1o.vo;

import com.Apo1o.entity.bfBg;
import com.Apo1o.entity.bhBg;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

/**
 * @Auther: Apo1o.
 * @Date: 2024/5/7-05-07-18:38
 * @Description： com.Apo1o.vo
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class bhBgInfoVo {
    private Integer id;

    private String name;

    private Double fbg;

    private Double cholesterol;

    private Double triglyceride;

    private Double ldlc;

    private Double hdlc;




    public static bhBgInfoVo fromBg(bhBg bhBg) throws IllegalArgumentException {
        // 输入验证
        if (bhBg == null) {
            throw new IllegalArgumentException("bfBasic对象不能为空");
        }

        bhBgInfoVo bbInfoVo = new bhBgInfoVo();
        try {
            // 异常处理：通过try-catch捕获潜在的异常
            BeanUtils.copyProperties(bhBg, bbInfoVo);
        } catch (Exception e) {
            // 这里可以根据实际情况记录日志或者抛出一个更合适的异常
            // 例如，可以使用日志框架记录异常信息
            throw new RuntimeException("属性复制过程中发生错误", e);
        }
        return bbInfoVo;
    }


}
